// BESPubOp

log using BESPubOp.log, replace
use "C:\Users\sbstjp\OneDrive - Cardiff University\BES2019_W26_v26.0.dta" // Fieldhouse, E., J. Green, G. Evans, J. Mellon, C. Prosser, J. Bailey, J. Griffiths, S. Perrett. (2023) British Election Study Internet Panel Waves 1-26. DOI: 10.5255/UKDA-SN-8202-2// Accessed on March 11 2025.

// Demographics
* Delete missing values and rename 
replace leftRight=. if leftRight==9999 
rename gender FemaleGender

* Generate dummy variables
gen Graduate=.
replace Graduate=0 if inrange(p_edlevelUni, 0, 3) 
replace Graduate=1 if inlist(p_edlevelUni, 4, 5)

gen MinorityEthnic=.
replace MinorityEthnic=0 if inlist(p_ethnicity, 1, 2)
replace MinorityEthnic=1 if inrange(p_ethnicity, 3, 15)

// Results
tab cwTrans [aweight=wt]
tab cwTrans if leftRight < 5 [aweight=wt]
tab cwTrans if leftRight > 5 [aweight=wt]
tab cwTrans if Graduate==0 [aweight=wt]
tab cwTrans if Graduate==1 [aweight=wt]
tab cwTrans if MinorityEthnic==0 [aweight=wt]
tab cwTrans if MinorityEthnic==1 [aweight=wt]
tab cwTrans if FemaleGender==1 [aweight=wt]
tab cwTrans if FemaleGender==2 [aweight=wt]
tab cwTrans if age<35 [aweight=wt]
tab cwTrans if age>=35 & age<=59 [aweight=wt]
tab cwTrans if age>59 [aweight=wt]

tab cwAuthors [aweight=wt]
tab cwAuthors if leftRight < 5 [aweight=wt]
tab cwAuthors if leftRight > 5 [aweight=wt]
tab cwAuthors if Graduate==0 [aweight=wt]
tab cwAuthors if Graduate==1 [aweight=wt]
tab cwAuthors if MinorityEthnic==0 [aweight=wt]
tab cwAuthors if MinorityEthnic==1 [aweight=wt]
tab cwAuthors if FemaleGender==1 [aweight=wt]
tab cwAuthors if FemaleGender==2 [aweight=wt]
tab cwAuthors if age<35 [aweight=wt]
tab cwAuthors if age>=35 & age<=59 [aweight=wt]
tab cwAuthors if age>59 [aweight=wt]

tab cwLanguage [aweight=wt]
tab cwLanguage if leftRight < 5 [aweight=wt]
tab cwLanguage if leftRight > 5 [aweight=wt]
tab cwLanguage if Graduate==0 [aweight=wt]
tab cwLanguage if Graduate==1 [aweight=wt]
tab cwLanguage if MinorityEthnic==0 [aweight=wt]
tab cwLanguage if MinorityEthnic==1 [aweight=wt]
tab cwLanguage if FemaleGender==1 [aweight=wt]
tab cwLanguage if FemaleGender==2 [aweight=wt]
tab cwLanguage if age<35 [aweight=wt]
tab cwLanguage if age>=35 & age<=59 [aweight=wt]
tab cwLanguage if age>59 [aweight=wt]

tab cwTraining  [aweight=wt]
tab cwTraining  if leftRight < 5 [aweight=wt]
tab cwTraining  if leftRight > 5 [aweight=wt]
tab cwTraining  if Graduate==0 [aweight=wt]
tab cwTraining  if Graduate==1 [aweight=wt]
tab cwTraining  if MinorityEthnic==0 [aweight=wt]
tab cwTraining  if MinorityEthnic==1 [aweight=wt]
tab cwTraining  if FemaleGender==1 [aweight=wt]
tab cwTraining  if FemaleGender==2 [aweight=wt]
tab cwTraining  if age<35 [aweight=wt]
tab cwTraining  if age>=35 & age<=59 [aweight=wt]
tab cwTraining  if age>59 [aweight=wt]

log close
